<?php
	function validation_peda_init(){
		global $CONFIG;

		$config = find_plugin_settings('validation_peda');
		if(isset($config)){
			$types=$config->validation_peda;
			$types=string_to_tag_array($types);		
		}
		register_translations($CONFIG->pluginspath . "validation_peda/languages/");
		//etendre la css

		if(in_array(get_context(),$types) || get_context()=='validation_peda' ){
			//ajouter le lien vers la demande de validation
			extend_view('editmenu','validation_peda/blogdemande');
			register_plugin_hook("comments", "object", "validatecomment");

		}
		extend_view('metatags','js/validation');
		add_widget_type('validation_peda',elgg_echo("categorie:validation"),elgg_echo("Widget pour Validation_peda"));
	}
	
	function validatecomment($hook, $entity_type, $returnvalue, $params){
		$validatecomment=elgg_view('validation_peda/beforevalidate', $params);
		return $validatecomment;
	}
	
	global $CONFIG;
	//action et events
	register_elgg_event_handler('init','system','validation_peda_init');
	register_action("validation_peda/demande",false,$CONFIG->pluginspath . "validation_peda/actions/demande.php");
	register_action("validation_peda/friendsearch",false,$CONFIG->pluginspath . "validation_peda/actions/friendsearch.php");
	register_action("validation_peda/add",false,$CONFIG->pluginspath . "validation_peda/actions/add.php");
	register_action("validation_peda/delete",false,$CONFIG->pluginspath . "validation_peda/actions/delete.php");
?>